﻿using System;
using System.Collections.Generic;
using Nop.Core.Domain.Logistics;
using Nop.Core.Domain.Shipping;

namespace Nop.Services.Logistics
{
    public interface ILogisticsProcessingService
    {
        bool CanCancelPackage(LogisticsPackage package);
        bool CancelPackage(LogisticsPackage package);
        bool CanChangeDeliveryAddress(LogisticsPackage package);
        bool CanChangeDeliveryAddress(LogisticsPackage package, out bool isFree);
        bool CanChangePickupAddress(LogisticsPackage package);
        bool ChangePackageDeliveryAddress(LogisticsPackage package, int addressId);
        bool ChangePackagePickupAddress(LogisticsPackage package, int addressId);
        IPackageHandle CreatePackageHandle(LogisticsPackage package);
        bool FailDelivery(LogisticsPackage package, PackageNoteTemplate failedReasonTemplate);
        List<ShippingStatus> GetNextStatuses(LogisticsPackage package);
        void RevertCollected(LogisticsPackage package);
        void RevertDelivered(LogisticsPackage package);
        bool UpdateStatus(LogisticsPackage package, ShippingStatus status);
        bool CanScheduleDelivery(LogisticsPackage package, out bool isFree);
        bool ScheduleDelivery(LogisticsPackage package, DateTime date, int? warehouseId = null);

        #region Plan

        /// <summary>
        /// Update all package status in a plan to in trasit
        /// </summary>
        /// <param name="plan"></param>
        void SetAllPackageDeliveringInPlan(LogisticsPlan plan);

        #endregion
    }
}
